package com.ml.servlet;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


/**
 * @author zzy
 *
 */
public class Login extends HttpServlet {

    protected void doGet(HttpServletRequest request, HttpServletResponse response) {
        doPost(request, response);
    }

    protected void doPost(HttpServletRequest request, HttpServletResponse response)  {
        //PrintWriter out = res.getWriter();

        try {
            request.setCharacterEncoding("UTF-8");
            response.setContentType("text/html; charset=UTF-8");
            //退出
            request.getSession().setAttribute("user",null);
            request.getSession().removeAttribute("user");
            request.getSession().setAttribute("flag",null);
            request.getSession().removeAttribute("flag");
            //response.sendRedirect("wk");
            request.getRequestDispatcher("/index.jsp").forward(request, response);
        } catch (Exception e) {
            e.printStackTrace();
        }
        //out.flush();
        //out.close();

    }
}
